﻿using UnityEngine;

namespace Share.Movement
{
    public class Rotate : MonoBehaviour
    {
        [SerializeField]
        private float m_RotateSpeed; // 旋转速度

        float m_RotateAngle;

        private void Awake()
        {

        }

        private void OnDisable()
        {
            transform.localRotation = Quaternion.Euler(0f, 0f, 0);
        }
        private void Update()
        {
            if (Mathf.Approximately(m_RotateSpeed, 0f))
            {
                XKLog.LogWarning("Rotate speed is zero, no rotation will occur.");
                return;
            }

            // 更新旋转角度
            m_RotateAngle += m_RotateSpeed * Time.deltaTime;
            // 播放状态下，限制角度范围
            transform.Rotate(0f, 0f, m_RotateSpeed * Time.deltaTime);

        }
    }
}